home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / games / pd / ashido / source / ashido.asm < prev    next >
Assembly Source File  |  1988-10-07  |  54KB  |  2,264 lines

  1.         opt    c-,l-,o1+,o2+,ow-
  2.  
  3. *****************************************************************************
  4. *                                                                           *
  5. *                                 A S H I D O                               *
  6. *                               ~~~~~~~~~~~~~~~                             *
  7. *                     © by Aragorn of CLUSTER / HAWK 1990                   *
  8. *                                                                           *
  9. *  Planned on 22.11.1990, Started on 04.11.1990, last update on 10.12.1990  *
  10. *                                                                           *
  11. *****************************************************************************
  12. *                                                                           *
  13. *   Structure of a stage:  12x7 plots (bytes), one byte is divided into     *
  14. *   two nibbles: xxxxyyyy, where x means the number of the color of the     *
  15. *   tile and y the pattern of the tile (see label 'Area').                  *
  16. *   Levels of difficulty:                                                   *
  17. *                                                                           *
  18. *          Level               Clock     Board     Touch                    *
  19. *      ------------------------------------------------------               *
  20. *        Freestyle               -         -         -                      *
  21. *        Scorer                  X         -         -                      *
  22. *        Explorer                -         X         -                      *
  23. *        Pioneer                 X         X         -                      *
  24. *        Hero                    -         X         X                      *
  25. *        Einstein                X         X         X                      *
  26. *                                                                           *
  27. *  For the different boards look at the label 'Table_1', -1 means empty     *
  28. *  plot.Use the '<<'-opcode to create the high-nibble, '!' for the low one. *
  29. *                                                                           *
  30. *****************************************************************************
  31.  
  32.             incdir    ram:include/
  33.             include    libraries/dosextens.i
  34.             include    exec/exec_lib.i
  35.             include    exec/execbase.i
  36.  
  37. OpenLibrary    equ    -552
  38. CloseLibrary    equ    -414
  39. AllocMem    equ    -198
  40. FreeMem        equ    -210
  41. Forbid        equ    -132
  42. Permit        equ    -138
  43. FindTask    equ    -294
  44. Output        equ    -60
  45. Open        equ    -30
  46. Close        equ    -36
  47. Read        equ    -42
  48. Write        equ    -48
  49. Delay        equ    -198
  50.  
  51. BLTCON0        equ    $040
  52. BLTCON1        equ    $042
  53. BLTAFWM        equ    $044
  54. BLTALWM        equ    $046
  55. BLTCPTH        equ    $048
  56. BLTBPTH        equ    $04C
  57. BLTAPTH        equ    $050
  58. BLTDPTH        equ    $054
  59. BLTSIZE        equ    $058
  60. BLTCMOD        equ    $060
  61. BLTBMOD        equ    $062
  62. BLTAMOD        equ    $064
  63. BLTDMOD        equ    $066
  64. DIWSTRT        equ    $08E
  65. DIWSTOP        equ    $090
  66. DDFSTRT        equ    $092
  67. DDFSTOP        equ    $094
  68. BPL1PTH        equ    $0E0
  69. BPL1PTL        equ    $0E2
  70. BPL2PTH        equ    $0E4
  71. BPL2PTL        equ    $0E6
  72. BPL3PTH        equ    $0E8
  73. BPL3PTL        equ    $0EA
  74. BPL4PTH        equ    $0EC
  75. BPL4PTL        equ    $0EE
  76. BPL5PTH        equ    $0F0
  77. BPL5PTL        equ    $0F2
  78. BPL6PTH        equ    $0F4
  79. BPL6PTL        equ    $0F6
  80. BPL1MOD        equ    $108
  81. BPL2MOD        equ    $10A
  82. BPLCON0        equ    $100
  83. BPLCON1        equ    $102
  84. BPLCON2        equ    $104
  85. DMACONW        equ    $096
  86. DMACONR        equ    $002
  87. COP1LCH        equ    $080
  88. COPJMP1        equ    $088
  89. BLTAPTL        equ    $052
  90. BLTADAT        equ    $074
  91. BLTBDAT        equ    $072
  92. JOY0DAT        equ    $00A
  93. JOY1DAT        equ    $00C
  94. SPR0PTH        equ    $120
  95. CIAAPRA        equ    $001
  96. VHPOSR        equ    $006
  97. STARTLIST    equ    38
  98.  
  99.         SECTION    "Startup",CODE
  100.  
  101.         movem.l    d0/a0,-(sp)
  102.         clr.l    _WBenchMsg
  103.         sub.l    a1,a1
  104.         CALLEXEC FindTask
  105.         move.l    d0,a4
  106.         tst.l    pr_CLI(a4)
  107.         beq.s    _WB
  108.         movem.l    (sp)+,d0/a0
  109.         bra.s    _run
  110. _WB        lea    pr_MsgPort(a4),a0
  111.         CALLEXEC WaitPort
  112.         lea    pr_MsgPort(a4),a0
  113.         CALLEXEC GetMsg
  114.         move.l    d0,_WBenchMsg
  115.         movem.l    (sp)+,d0/a0
  116. _run        jsr    _Main
  117.         move.l    d0,-(sp)
  118.         tst.l    _WBenchMsg
  119.         beq.s    _Exit
  120.         CALLEXEC Forbid
  121.         move.l    _WBenchMsg(pc),a1
  122.         CALLEXEC ReplyMsg
  123. _Exit        move.l    (sp)+,d0
  124.         rts
  125.  
  126. _WBenchMsg    ds.l    1
  127.  
  128.         SECTION    "Ashido",CODE
  129.  
  130. _Main        move.l    4.w,a6            allocate mem and open libs
  131.         lea    DOSName,a1
  132.         moveq    #0,d0
  133.         jsr    OpenLibrary(a6)
  134.         move.l    d0,DosBase
  135.         lea    $dff000,a5
  136.         move.l    #2*5*256*40+10000+4+6*4+4+8,d0
  137.         move.l    #$10002,d1
  138.         jsr    AllocMem(a6)
  139.         tst.l    d0
  140.         beq    Error_1
  141.         move.l    d0,Mem
  142.         move.l    d0,Plane_1
  143.         add.l    #5*256*40,d0
  144.         move.l    d0,Plane_2
  145.         add.l    #5*256*40,d0
  146.         move.l    d0,Copper
  147.         add.l    #10000,d0
  148.         move.l    d0,Sprite
  149.         add.l    #4+6*4+4,d0
  150.         move.l    d0,Empty
  151.  
  152.         move.l    DosBase,a6
  153.         move.l    #Filename,d1        try to load highscores
  154.         move.l    #1005,d2
  155.         jsr    Open(a6)
  156.         tst.l    d0
  157.         beq.s    .No_High
  158.         move.l    d0,d7
  159.         move.l    d7,d1
  160.         move.l    #Highscores,d2
  161.         move.l    #6*6*24,d3
  162.         jsr    Read(a6)
  163.         move.l    d7,d1
  164.         jsr    Close(a6)
  165. .No_High    move.l    4.w,a6
  166.  
  167.         bsr    Create_Mask        create tile-masks
  168.         bsr    Set_RND            set RND to rnd (uh...)
  169.  
  170.         move.l    Copper,a0        create copperlist
  171.         lea    Colortable_1,a1
  172.         move.l    #Cols_1/2-1,d0
  173.         move.l    #$210ffffe,d1
  174. SetCols_1    move.l    d1,(a0)+
  175.         move.w    #$180,(a0)+
  176.         move.w    (a1)+,(a0)+
  177.         add.l    #$01000000,d1
  178.         dbra    d0,SetCols_1
  179.         move.l    #$fffffffe,(a0)
  180.  
  181.         jsr    Forbid(a6)        set registers
  182.         move.w    #$7fff,DMACONW(a5)
  183.         move.l    Copper,COP1LCH(a5)
  184.         clr.w    COPJMP1(a5)
  185.         move.w    #$3081,DIWSTRT(a5)
  186.         move.w     #$30c1,DIWSTOP(a5)
  187.         move.w  #$0038,DDFSTRT(a5)
  188.         move.w  #$00d0,DDFSTOP(a5)
  189.         move.w  #%0101000000000000,BPLCON0(a5)
  190.         move.w    #0,BPLCON1(a5)
  191.         move.w    #%0000000000100100,BPLCON2(a5)
  192.         move.w    #0,BPL1MOD(a5)
  193.         move.w    #0,BPL2MOD(a5)
  194.  
  195.         move.l    Sprite,a2        create sprites
  196.         move.w    #0,(a2)+
  197.         move.w    #0,(a2)+
  198.         lea    sprptr,a1
  199.         moveq    #6*2-1,d0
  200. setptr        move.w    (a1)+,(a2)+
  201.         dbra    d0,setptr
  202.         move.w    #0,(a2)+
  203.         move.w    #0,(a2)+
  204.         move.l    Empty,a1
  205.         move.l    #0,(a1)+
  206.         move.l    #0,(a1)+
  207.         move.l    Sprite,a0
  208.         move.l    #268,d0
  209.         move.l    #160,d1
  210.         move.l    #274,d2
  211.         move.l    #0,d3
  212.         bsr    Set_Spritepos
  213.         move.l    #268,ptr_x
  214.         move.l    #268,prev_x
  215.         move.l    #160,ptr_y
  216.         move.l    #160,prev_y
  217.  
  218.         move.w    #%1000011111111111,DMACONW(a5)
  219.  
  220.         move.l    #0,Clockflag        set IRQ-flags + IRQ-ptr
  221.         move.l    #0,Scrollflag
  222.         bchg    #1,$bfe001
  223.         jsr    Start_Muzak
  224.         move.l    $6c,OldIRQ+2
  225.         move.l    #NewIRQ,$6c
  226.  
  227.         move.l    #5,GameMode        Mode = Einstein
  228.         move.l    #0,The_Flag        clear the mysterious flag
  229.  
  230. Title        move.l    #0,Clockflag
  231.         bsr    Clear_Plane
  232.         move.l    #256*44,bpsize
  233.         move.w  #%0100000000000000,BPLCON0(a5)
  234.         move.w    #4,BPL1MOD(a5)        change into overscan
  235.         move.w    #4,BPL2MOD(a5)        for scrolltext
  236.         move.l    #1,Colorflag
  237.  
  238.         lea    Titleline_1,a0        give out ashido
  239.         move.l    Plane_1,a1
  240.         addq.l    #2,a1
  241.         bsr    BigPrint
  242.         move.l    #Text,vektor        start scrolltext
  243.         move.l    #8,Smooth
  244.         move.l    #1,Scrollflag
  245.  
  246. Page_I        lea    Page_1,a0
  247.         moveq    #7,d7
  248.         move.l    #38*44,d6
  249. .PrintPage    move.l    Plane_1,a1
  250.         add.l    d6,a1
  251.         bsr    Print
  252.         add.l    #16*44,d6
  253.         dbra    d7,.PrintPage
  254.         move.l    #$70000,d0
  255.         move.b    #0,$bfec01
  256. .Wait        subq.l    #1,d0
  257.         beq.s    Page_II
  258.         move.b    $bfec01,d1
  259.         beq.s    .NoKey
  260.         bsr    Check_Key
  261.         tst.l    d1
  262.         bne.s    Page_II
  263. .NoKey        btst    #6,$bfe001
  264.         bne.s    .Wait
  265.         bra    Start_Game
  266.  
  267. Page_II        lea    Page_2,a0
  268.         moveq    #7,d7
  269.         move.l    #38*44,d6
  270. .PrintPage    move.l    Plane_1,a1
  271.         add.l    d6,a1
  272.         bsr    Print
  273.         add.l    #16*44,d6
  274.         dbra    d7,.PrintPage
  275.         lea    Modi,a0
  276.         move.l    Plane_1,a1
  277.         add.l    #38*44,a1
  278.         move.l    GameMode,d0
  279.         mulu    #41,d0
  280.         add.l    d0,a0
  281.         bsr    Print
  282.         move.l    #$70000,d0
  283.         move.b    #0,$bfec01
  284. .Wait        subq.l    #1,d0
  285.         beq.s    Page_Highs
  286.         move.b    $bfec01,d1
  287.         beq.s    .NoKey
  288.         bsr    Check_Key
  289.         tst.l    d1
  290.         bne.s    Page_II
  291. .NoKey        btst    #6,$bfe001
  292.         bne.s    .Wait
  293.         bra    Start_Game
  294.  
  295. Page_Highs    lea    High_strings,a0
  296.         move.l    GameMode,d0
  297.         mulu    #41,d0
  298.         add.l    d0,a0
  299.         move.l    Plane_1,a1
  300.         add.l    #38*44,a1
  301.         bsr    Print
  302.         lea    Empty_line,a0
  303.         move.l    Plane_1,a1
  304.         add.l    #54*44,a1
  305.         bsr    Print
  306.         lea    Highscores,a0
  307.         move.l    GameMode,d0
  308.         mulu    #6*24,d0
  309.         add.l    d0,a0
  310.         moveq    #5,d7
  311.         move.l    #70*44,d6
  312. .Print_Highs    movem.l    d0-d7/a0-a6,-(sp)
  313.         lea    TextBuffer,a1
  314.         moveq    #39,d0
  315. .Clear_Buffer    move.b    #" ",(a1)+
  316.         dbra    d0,.Clear_Buffer
  317.         move.b    #0,(a1)
  318.         move.l    (a0)+,d0
  319.         move.l    #5,d1            give out Scores
  320.         moveq    #0,d2
  321.         lea    TextBuffer+6,a0
  322.         bsr    BinDec
  323.         move.b    #" ",5(a0)
  324.         movem.l    (sp),d0-d7/a0-a6
  325.         lea    TextBuffer+16,a1
  326.         addq.l    #4,a0
  327.         moveq    #23,d0
  328. .CopyName    move.b    (a0)+,(a1)+
  329.         dbra    d0,.CopyName
  330.         lea    TextBuffer,a0
  331.         move.l    Plane_1,a1
  332.         add.l    d6,a1
  333.         bsr    Print
  334.         movem.l    (sp)+,d0-d7/a0-a6
  335.         add.l    #24,a0
  336.         add.l    #16*44,d6
  337.         dbra    d7,.Print_Highs
  338.         move.l    #$70000,d0
  339.         move.b    #0,$bfec01
  340. .Wait        subq.l    #1,d0
  341.         beq.s    Page_III
  342.         move.b    $bfec01,d1
  343.